/**
 *
 * @description login验证
 */

const { ErrorModel } = require("../messageModel/index");

async function loginCheck(ctx, next) {
  const { userInfo } = ctx.session;
  if (userInfo && userInfo.username) {
    await next();
  } else {
    ctx.body = new ErrorModel(-1, "未登录");
  }
}

module.exports = loginCheck;
